package com.project.service.impl;

import java.util.List;
import java.util.Map;

import com.project.entity.ProjectCheckRecord;
import com.project.mapper.ProjectCheckRecordMapper;
import com.project.service.CheckManage;

public class CheckManageService implements CheckManage {
	private ProjectCheckRecordMapper projectCheckRecordMapper;
	private ProjectCheckRecord projectCheckRecord;

	public ProjectCheckRecordMapper getProjectCheckRecordMapper() {
		return projectCheckRecordMapper;
	}

	public void setProjectCheckRecordMapper(
			ProjectCheckRecordMapper projectCheckRecordMapper) {
		this.projectCheckRecordMapper = projectCheckRecordMapper;
	}

	public ProjectCheckRecord getProjectCheckRecord() {
		return projectCheckRecord;
	}

	public void setProjectCheckRecord(ProjectCheckRecord projectCheckRecord) {
		this.projectCheckRecord = projectCheckRecord;
	}

	public List<ProjectCheckRecord> getAllRecord(Map<String, String> map) {
		// TODO Auto-generated method stub
		return this.projectCheckRecordMapper.getAllRecord(map);
	}
	
	
	public int countCheckRecord(){
		int i=0;
		i = this.projectCheckRecordMapper.countByExample(null);
		return i;
	}
	
	/**
	 * 新增验收记录
	 */
	public int addCheckRecord(ProjectCheckRecord record){
		int i;
		try{
			i = this.projectCheckRecordMapper.insert(record);
		}catch(Exception e){
			i = -1;
			e.printStackTrace();
		}
		return i;
	}

	public int updateCheckRecord(ProjectCheckRecord record) {
		int i ;
		try{
			i = this.projectCheckRecordMapper.updateRecord(record);
		}catch(Exception e){
			i = -1;
			e.printStackTrace();
		}
		return 0;
	}

	public int acceptProject(String number) {
		// TODO Auto-generated method stub
		int i;
		try{
			i = this.projectCheckRecordMapper.acceptProject(number);
		}catch(Exception e){
			i= -1;
		}
		return i;
	}

}
